home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Files / XTND 1.3.6 / XTND Headers / XTNDCIncludes / XTNDTextTranslator.h < prev   
Encoding:
C/C++ Source or Header  |  1992-02-26  |  12.4 KB  |  323 lines  |  [TEXT/MPS ]

  1. /********************************************************************************
  2. *                                                                                *
  3. *    XTNDTextTranslator.h                                                        *
  4. *                                                                                *
  5. *    Header file for text translators.                                            *
  6. *                                                                                *
  7. *    Copyright © 1989-91 Claris Corporation                                        *
  8. *    All Rights Reserved                                                            *
  9. *                                                                                *
  10. ********************************************************************************/
  11.  
  12. #ifndef __XTNDTEXTTRANSLATOR__
  13. #define __XTNDTEXTTRANSLATOR__
  14.  
  15.  
  16. #include "XTNDInterface.h"
  17. #include <Printing.h>
  18.  
  19. /* Defines for Directive to be passed to import translators */
  20. enum ImportDirectives
  21. {
  22.     importAcknowledge = -1,    /* Value set by a translator to acknowledge an action */
  23.  
  24.     importGetResources,
  25.     importInitAll,
  26.  
  27.     importInitRightHeader,
  28.     importInitLeftHeader,
  29.     importInitHeader,
  30.  
  31.     importInitRightFooter,
  32.     importInitLeftFooter,
  33.     importInitFooter,
  34.  
  35.     importInitMain,
  36.  
  37.     importInitFootnote,
  38.  
  39.     importGetText,
  40.  
  41.     importCloseRightHeader,
  42.     importCloseLeftHeader,
  43.     importCloseHeader,
  44.  
  45.     importCloseRightFooter,
  46.     importCloseLeftFooter,
  47.     importCloseFooter,
  48.  
  49.     importCloseMain,
  50.  
  51.     importCloseFootnote,
  52.  
  53.     importCloseAll
  54. };
  55.  
  56.  
  57. /* Defines for Directive to be passed to export translators */
  58. enum ExportDirectives
  59. {
  60.     exportAcknowledge = -1,    /* Value set by a translator to acknowledge an action */
  61.  
  62.     exportInitAll,
  63.  
  64.     exportOpenRightHeader,
  65.     exportOpenLeftHeader,
  66.     exportOpenHeader,
  67.  
  68.     exportOpenRightFooter,
  69.     exportOpenLeftFooter,
  70.     exportOpenFooter,
  71.  
  72.     exportOpenFootnote,
  73.  
  74.     exportOpenMain,
  75.  
  76.     exportWriteText,
  77.  
  78.     exportCloseRightHeader,
  79.     exportCloseLeftHeader,
  80.     exportCloseHeader,
  81.  
  82.     exportCloseRightFooter,
  83.     exportCloseLeftFooter,
  84.     exportCloseFooter,
  85.  
  86.     exportCloseFootnote,
  87.  
  88.     exportCloseMain,
  89.  
  90.     exportCloseAll,
  91.  
  92.     exportWriteResources
  93. };
  94.  
  95.  
  96. /* Defines for CurrentStory */
  97. #define rightHeaderStory    1
  98. #define leftHeaderStory        2
  99. #define headerStory            3
  100. #define rightFooterStory    4
  101. #define leftFooterStory        5
  102. #define footerStory            6
  103. #define footnoteStory        7
  104. #define mainStory            8
  105.  
  106.  
  107. /* Defines for header/footer pages */
  108. #define everyPage            1
  109. #define leftPage            2
  110. #define rightPage            4
  111.  
  112.  
  113. /* XTND 1.x special characters */
  114. #define pageNumber         0x02    /* Current page number character */
  115. #define    footnoteChar     0x03    /* Footnote character in the footnote */
  116. #define floatingPict     0x04    /* Floating picture marker */
  117. #define footnoteMark    0x05    /* Footnote character in the text */
  118. #define mergeBreak         0x06    /* Mail merge document break */
  119. #define hardReturn         0x07    /* Hard return (does not create new paragraph) */
  120. #define tabChar            0x09    /* Tab character */
  121. #define newColumn         0x0B    /* Column break character */
  122. #define newPage         0x0C    /* Page break character */
  123. #define returnChar        0x0D    /* Paragraph break character */
  124. #define shortDateChar    0x15    /* Assorted date characters */
  125. #define abbrDateChar    0x16
  126. #define longDateChar    0x17
  127. #define dayAbbrDateChar    0x18    /* Date characters with day of week included */
  128. #define dayLongDateChar    0x19
  129. #define timeChar        0x1A    /* Time character */
  130. #define softHyphen         0x1F    /* Discretionary hyphen character */
  131.  
  132. /* Other character values */
  133. #define enterChar        0x03
  134.  
  135.  
  136. /* XTND 1.x limits */
  137. #define    numParaFmts    9                /* Number of fields in a paragraph specification */
  138. #define maxCols        10                /* Maximum number of columns allowed */
  139. #define    maxTabs        20                /* Maximum number of tabs allowed */
  140. #define minGutter    (0x00030000)    /* (minimum gutter) 3 points as a Fixed number */
  141. #define maxGutter    (0x01200000)    /* (maximum gutter) 288 points as a Fixed number */
  142. #define dfltGutter    (0x00090000)    /* (default gutter) 9 points as a Fixed number */
  143.  
  144.  
  145. /* XTND 1.x text styles */
  146. #define textPlain             0x00
  147. #define textSuperScript        0x20
  148. #define textSubScript        0x40
  149. #define textNonbreaking        0x80
  150. #define textSuperior        0x100
  151. #define textStrikeThru        0x200
  152. #define textAllCaps            0x400   
  153. #define textSmallCaps        0x800
  154. #define textWordUnderline    0x1000
  155. #define textDoubleUnderline    0x2000
  156. #define textLowerCase        0x4000
  157.  
  158.  
  159. /* XTND 1.x justification/tab alignment values */
  160. #define textLeft        0
  161. #define textCenter        1
  162. #define textRight        2
  163. #define textJustified    3        /* For text */
  164. #define textDecimal        3        /* For tabs */
  165.  
  166.  
  167. /* XTND 1.x text color values */
  168. #define textWhite        0
  169. #define textBlack        1
  170. #define textRed            2
  171. #define textGreen        3
  172. #define textBlue        4
  173. #define textCyan        5
  174. #define textMagenta        6
  175. #define textYellow        7
  176. #define textOtherColor    8
  177.  
  178.  
  179. /* ——————  T Y P E   D E F I N I T I O N S  —————— */
  180.  
  181. /* Tab specifications record.  The tab array contains 20 of these */    
  182. struct TabSpec
  183. {            
  184.     unsigned char    tabJust;        /* Tab justification (left, right, center, aligned) */
  185.     unsigned char    tabLead;        /* Tab leader character (default is space) */
  186.     Fixed            tabIndent;        /* Tab indent in points from left page margin */
  187.     unsigned char    decAlign;        /* Tab alignment character (usually period) */
  188. };
  189. typedef struct TabSpec TabSpec;
  190. typedef TabSpec    TabSpecArray[20];
  191.  
  192.  
  193. /* The PictMisc data structure is used to import a quickdraw picture */
  194. struct PictMisc
  195. {
  196.     PicHandle        thePicture;        /* handle to the quickdraw picture */
  197.     long            pictSize;        /* Size of associated picture */
  198.     Rect            destRect;        /* Used for scaling the picture, OrigRect will be scaled to this rect */
  199.     Rect            origRect;        /* Used for cropping the picture, pictRect will be cropped to this rect */
  200.     char            reserved[38];    /* Reserved, fill with zeros */
  201. };
  202. typedef struct PictMisc PictMisc;
  203. typedef PictMisc *PictMiscPtr, **PictMiscHdl;
  204.  
  205. /* Paragraph format record.  The ParaFormats array contains 9 Fixed values */    
  206. typedef    Fixed        ParaFormat;
  207. typedef    ParaFormat    ParaFormats[9];
  208.  
  209. /* This is the parameter block for passing information to an import translator */
  210. struct ImportParmBlock
  211. {
  212.     Ptr                textBuffer;        /* Pointer to 256 bytes of data */
  213.     short            directive;        /* Indicates the action to be performed */
  214.     OSErr            result;            /* Return code, 0 if successful, error code otherwise */
  215.     long            textLength;        /* Number of characters of information being returned */
  216.     short            translatorState;/* Available for use by the translator */
  217.     short            refNum;            /* Reference number of the fork to be read by the translator */
  218.     short            txtFace;        /* Current text face */
  219.     short            txtSize;        /* Current text font size */
  220.     short            txtFont;        /* Current text font family number */
  221.     short            txtColor;        /* Current text color (XTND 1.x color value) */
  222.     short            txtJust;        /* Justification of this text */
  223.     short            unused1;        /* Must be zero */
  224.     ParaFormat        *paraFmts;        /* Pointer to this paragraph's format array */
  225.     TabSpec            *tabs;            /* Pointer to this paragraph's tab array */
  226.     Boolean            unused2;        /* Currently unused */
  227.     char            numCols;        /* Number of columns expected */
  228.     short            currentStory;    /* Header,Footer,Main Body, etc. */
  229.     long            miscData;        /* For importing pictures, etc. */
  230.     short            storyHeight;    /* Height of header,footer, etc. */
  231.     unsigned char    decimalChar;    /* Default char to align decimal tab on */
  232.     Boolean            autoHyphenate;    /* If TRUE, auto hyphenation is on */
  233.     THPrint            printRecord;    /* Print record, if one is used, otherwise zero*/
  234.     Fixed            topMargin;        /* Document top margin */
  235.     Fixed            bottomMargin;    /* Document bottom margin */
  236.     Fixed            leftMargin;        /* Document left margin */
  237.     Fixed            rightMargin;    /* Document right margin */
  238.     Fixed            gutter;            /* Space between columns */
  239.     short            startPageNum;    /* Starting page number */
  240.     short            startFootnoteNum;    /* starting footnote number */
  241.     StringPtr        footnoteText;    /* If not empty, text associated with footnote, else atuo */
  242.     Boolean            rulerShowing;    /* If TRUE, ruler is showing */
  243.     Boolean            doubleSided;    /* If TRUE, document has Left/Right pages */
  244.     Boolean            titlePage;        /* If TRUE, document has a title page (with no headers/footers) */
  245.     Boolean            endnotes;        /* If TRUE, footnotes are displayed as endnotes */
  246.     Boolean            showInvisibles;    /* If TRUE, invisible characters will be displayed */
  247.     Boolean            showPageGuides;    /* If TRUE, page guides will be displayed */
  248.     Boolean            showPictures;    /* If TRUE, pictures will be displayed */
  249.     Boolean            autoFootnotes;    /* If TRUE, footnotes will be numbered automatically */
  250.     Point            pagePoint;        /* Position for page number within header/footer */
  251.     Point            datePoint;        /* Position for date character within header/footer */
  252.     Point            timePoint;        /* Position for time character within header/footer */
  253.     Handle            globalHandle;    /* Handle to translator globals, if needed */
  254.     Boolean            smartQuotes;    /* If TRUE, smart quotes will be used */
  255.     Boolean            fractCharWidths;/* If TRUE, fractional character widths will be used */
  256.     short            hRes;            /* The horizontal resolution of this document (default is 72) */
  257.     short            vRes;            /* The vertical resolution of this document (default is 72) */
  258.     Rect            windowRect;        /* May be used to specify document window placement and size */
  259.     SFReply            theReply;        /* Standard reply record describing the file being translated */
  260.     TransDescribe    thisTranslator;    /* TransDescribe record describing this translator */
  261. };
  262. typedef struct ImportParmBlock ImportParmBlock;
  263. typedef ImportParmBlock *ImportParmBlkPtr;
  264.  
  265. /* This is the parameter block for passing information to an export translator */
  266. struct ExportParmBlock
  267. {
  268.     char            directive;        /* Indicates the action to be performed */
  269.     OSErr            *result;        /* Pointer to return code, 0 if successful, error code otherwise */
  270.     short            *refNum;        /* Pointer to reference number of the file being written by the translator */
  271.     long            *textLength;    /* Pointer to number of characters being exported */
  272.     Handle            globalHandle;    /* Handle to translator globals, if needed */
  273.     long            reserved1;        /* Do not change this value */
  274.     Handle            textBuffer;        /* Handle to the text being exported */
  275.     short            *txtFace;        /* Pointer to the current text face */
  276.     short            *txtSize;        /* Pointer to the current text font size */
  277.     short            *txtFont;        /* Pointer to the current text font family number */
  278.     char            *txtColor;        /* Pointer to the current text color (XTND 1.x color value) */
  279.     short            *txtJust;        /* Pointer to the justification of this text */
  280.     ParaFormat        *paraFmts;        /* Pointer to this paragraph's format array */
  281.     TabSpec            *tabs;            /* Pointer to this paragraph's tab array */
  282.     PicHandle        thePicture;        /* Handle to a quickdraw picture */
  283.     Rect            pictRect;        /* Rectangle describing the display rect of the above picture */
  284.     short            headerStatus;    /* Shows if header is on left/right/every page */
  285.     short            footerStatus;    /* Shows if footer is on left/right/every page */
  286.     short            currentStory;    /* Header, Footer, Main Body, etc. */
  287.     short            numCols;        /* Number of columns in document */
  288.     Fixed            topMargin;        /* Document top margin */
  289.     Fixed            bottomMargin;    /* Document bottom margin */
  290.     Fixed            leftMargin;        /* Document left margin */
  291.     Fixed            rightMargin;    /* Document right margin */
  292.     Fixed            gutter;            /* Space between columns */
  293.     long            totalCharCount;    /* Total number of chars in document (for Word 3.0) */
  294.     long            footnoteOffset;    /* If current story is a footnote, its offset in doc */
  295.     StringPtr        footnoteText;    /* If !autoFootnotes, text for footnote (Pascal String) */
  296.     short            startPageNum;    /* Starting page number */
  297.     short            startFootnoteNum;    /* Starting footnote number */
  298.     Boolean            rulerShowing;    /* if TRUE, ruler is showing */
  299.     Boolean            doubleSided;    /* if TRUE, document has Left/Right pages */
  300.     Boolean            titlePage;        /* If TRUE, document has a title page (with no headers/footers) */
  301.     Boolean            endnotes;        /* If TRUE, footnotes are displayed as endnotes */
  302.     Boolean            showInvisibles;    /* If TRUE, invisible characters are displayed */
  303.     Boolean            showPageGuides;    /* If TRUE, page guides are displayed */
  304.     Boolean            showPictures;    /* If TRUE, pictures are displayed */
  305.     Boolean            autoFootnotes;    /* If TRUE, footnotes are numbered automatically */
  306.     Boolean            footnotesExist;    /* If TRUE, footnotes are being exported */
  307.     THPrint            printRecord;    /* Print record for this document */
  308.     Point            pagePoint;        /* Point where page number is displayed in header or footer */
  309.     Point            datePoint;        /* Point where date character is displayed in header or footer */
  310.     Point            timePoint;        /* Point where time character is displayed in header or footer */
  311.     Boolean            smartQuotes;    /* If TRUE, SmartQuotes are turned on */
  312.     Boolean            fractCharWidths;/* If TRUE, fractional character widths are turned on */
  313.     short            hRes;            /* The horizontal resolution of this document */
  314.     short            vRes;            /* The vertical resolution of this document */
  315.     Rect            windowRect;        /* Rectangle specifying document window placement and size */
  316.     SFReply            theReply;        /* Standard reply record describing the file being written */
  317.     TransDescribe    thisTranslator;    /* TransDescribe record describing this translator */
  318. };
  319. typedef struct ExportParmBlock ExportParmBlock;
  320. typedef ExportParmBlock *ExportParmBlkPtr;
  321.  
  322. #endif
  323.